/**
 * @file Decorator
 * @author liyong18@baidu.com
 *
 * https://github.com/JedWatson/react-select
 */
/* eslint-disable */

var React = require('react');
var Mixin = require('./Mixin.js');
var extend = require('lodash/extend');
module.exports = function () {
  return function (Component) {
    return React.createClass({
      mixins: [Mixin],
      render: function () {
        var props = {
          setValidations: this.setValidations,
          setValue: this.setValue,
          resetValue: this.resetValue,
          getValue: this.getValue,
          hasValue: this.hasValue,
          getErrorMessage: this.getErrorMessage,
          getErrorMessages: this.getErrorMessages,
          isFormDisabled: this.isFormDisabled,
          isValid: this.isValid,
          isPristine: this.isPristine,
          isFormSubmitted: this.isFormSubmitted,
          isRequired: this.isRequired,
          showRequired: this.showRequired,
          showError: this.showError,
          isValidValue: this.isValidValue
        };
        props = extend(props, this.props);
        return React.createElement(Component, props);
      }
    });
  };
};
